package com.ccys.db.mapper;

import com.ccys.db.dto.web.base.RoleModuleDto;
import com.ccys.db.entity.SysRoleModule;
import com.ccys.db.vo.web.base.RoleModuleVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;

import java.util.List;

/**
* Created by Mybatis Generator on 2023/12/08
*/
public interface SysRoleModuleMapper extends Mapper<SysRoleModule>, MySqlMapper<SysRoleModule> {
    /**
     * 删除角色模块关系
     * @param roleId
     * @return
     */
    @Delete("delete " +
            "from " +
            "role_module " +
            "where " +
            "role_id = #{roleId}")
    int deleteRelation(@Param("roleId") String roleId);

    /**
     * 更新角色模块信息 放置于一条commit
     * @param roleId
     * @param moduleIds
     * @return
     */
    int insertRelation(@Param("roleId") String roleId,
                       @Param("moduleIds") List<String> moduleIds,
                       @Param("createdBy") String createdBy);


    /**
     * 用户拥有模块查询
     * @param roleModuleDto
     * @return
     */
    List<RoleModuleVo> userModuleQuery(RoleModuleDto roleModuleDto);
}